#include <cstdio>
#include <cstring>	
#include <iostream>
#include <cmath>
using namespace std;

int n,m,a[300];

void pr(int k,int last)
{
	if (k>m) 
	{ 
		for (int i=1;i<=m;i++)
			printf("%3d",a[i]);
		printf("\n");
		//printf("%2d\n",a[m]);
		return; 
	}
	for (int i=last+1;i<=n;i++)
	{
		a[k]=i;
		pr(k+1,i);
	}
}

int main()
{
	//freopen("compages_data//compages5.in","r",stdin);
	cin>>n>>m;
	pr(1,0);
	
	return 0;
	}
	
	


